#ifndef CARDPANEL_H
#define CARDPANEL_H
#include"card.h"
#include"player.h"
#include <QWidget>
#include<QPixmap>
#include"cards.h"
class CardPanel : public QWidget
{
    Q_OBJECT
public:
    explicit CardPanel(QWidget *parent = nullptr);
    //设置获取图片函数
    void setImage(QPixmap &front,QPixmap &back);
    QPixmap getImage();

    //扑克牌显示哪一面
    void setFrontsize(bool flag);
    bool getFrontsize();

    //记录窗口是否被选中
    void setSelected(bool flag);
    bool getSelected();

    //扑克牌的花色及其点数
    void setCard(Card &card);
    Card getCard();

    //扑克牌的拥有者
    void setOwner(Player *player);
    Player* getOwner();
    void clicked();
private:
    QPixmap m_front;
    QPixmap m_back;
    bool m_isfront = true;
    bool m_isSelected = false;
    Card m_card;
    Player *m_owner = nullptr;
signals:
    void CardSelected(Qt::MouseButton button);
    // QWidget interface
protected:
    virtual void paintEvent(QPaintEvent *event) override;

    // QWidget interface
protected:
    virtual void mousePressEvent(QMouseEvent *event) override;
};




#endif // CARDPANEL_H
